<?=form_open(current_url())?>
<fieldset>
    <legend>Add New Project</legend>
	<div class="row-fluid">
		<div class="span4">
			<label> <strong>Project Manager</strong> <a href="#" class="tooltips" title="Select the user to whom project will be assigned"><i class="icon-question-sign"></i></a></label>
    <select class="chzn-select" name="user">
    <option value=""  >Select a User</option>
     <?php foreach ($users as $user) {
	 	if(!$this->ion_auth->is_client($user->user_id) AND $this->ion_auth->is_active($user->user_id) ){		
		?>
      <option value="<?=$user->user_id?>" ><?=$user->username?></option>
     <?php }}?>
    </select>
    <span class="text-error"><?= form_error('user')?></span>
			
		</div>
		<div class="span5">
			<label> <strong>Department  </strong><a href="#" class="tooltips" title="Select the department to which project will be assigned"><i class="icon-question-sign"></i></a></label>
    <select class="chzn-select" name="department_id">
    <option value=""  >Select a department</option>
     <?php foreach ($departments as $department) {?>
      <option value="<?=$department->id?>"><?=$department->name?></option>
     <?php }?>
    </select>
    <span class="text-error"><?= form_error('user')?></span>
			
		</div>
	<div class="span3">
		<label> <strong>Client</strong>  <a href="#" class="tooltips" title="Select client or choose none"><i class="icon-question-sign"></i></a> <small></small></label>
		 <select class="chzn-select" name="client_id">
    	 <option value="0">Select Client</option>
		 <?php foreach($clients as $client) {?>
		 <option value="<?php echo $client->id; ?>"><?php echo $client->first_name ?></option>
		 <?php }?>
    </select>
	<label><a href="<?php echo site_url().'/'.'client/client/add_client'?>"><i class="icon-plus-sign "></i> Add client</a></label>
	</div>	
	</div>
	<br />
	
	
	<label> <strong>Project Name  </strong><small class="muted">( Name / title of the project )</small></label>
    <input type="text" name="name" value="<?=set_value('name')?>" class="span12" />
    <span class="text-error"><?= form_error('name')?></span>
	
	
	<label> <strong>Description  </strong><small class="muted"> ( description of the current project )</small></label>
    <textarea name="desc" class="span12"><?=set_value('desc')?></textarea>
    <span class="text-error"><?= form_error('desc')?></span>
	
	<label> <strong>Start date  </strong><small class="muted">( Choose a time when the project will be started )</small></label>
    <input type="text" name="start_date" id="dpd1"  value="<?=set_value('start_date')?>" class="span12"/>
    <span class="text-error"><?= form_error('start_date')?></span>
	
	<label> <strong>Due Date  </strong><small class="muted">( Last date of the project to be completed )</small></label>
    <input type="text" name="due_date" id="dpd2" value="<?=set_value('due_date')?>" class="span12"/>
    <span class="text-error"><?= form_error('due_date')?></span>
	<br />	
	<button class="btn btn-success pull-right">Proceed Next</button>	
	</fieldset>   
</form>
<hr />
<h3>Project Details</h3>
<table width="100%" id="example" class="table table-condensed">
<thead>
  <tr>
    <th>Name</th>
    <th>Description</th>
    <th>Start Date</th>
    <th>Due date</th>
    <th>Created on</th>
    <th>Created by</th>
    <th>Status</th>
	<th>Action</th>
    <th>Links</th>
  </tr>
  </thead>
  <?php foreach($projects as $project) {?>
  <tr>
    <td><?= $project->name?></td>
    <td><?= $project->desc?></td>
    <td><?= $project->start_date?></td>
    <td><?= $project->end_date?></td>
        <td><?= $project->created_on?></td>
            <td><?= $project->username?></td>
    <td><?php 
	if($project->is_completed == 0)
	{
	echo "Incompleted";	
	}
	else{ echo "Completed";}
	?></td>
	<td><a href="<?php echo site_url('user/tasks/edit_project').'/'.$project->id;?>"><i class="icon-edit"></i></a></td>
    <td>
    <a href="<?= site_url('user/tasks/milestones').'/'.$project->id;?>"> Milestone</a>     
    </td>
	
  </tr>
  <?php }?>  
</table>

